import {
  BatchEditModuleParam,
  CreateModuleParam,
  CreateModuleResultModel,
  DeleteModuleParam,
  EditModuleParam,
  GetDescendantsResult,
  ModuleInfo,
  DependInfo,
  GetDependListParam,
} from './model/moduleModel'
import { defHttp } from '/@/utils/http/axios'

export const getChildren = (params?: any) =>
  defHttp.get<ModuleInfo[]>({ url: '/module/children', params })

export const getDescendants = (params?: any) =>
  defHttp.get<GetDescendantsResult>({ url: '/module/descendants', params })

export const createModule = (params: CreateModuleParam) =>
  defHttp.post<CreateModuleResultModel>({ url: '/module/create', data: params })

export const editModule = (params: EditModuleParam) =>
  defHttp.post<void>({ url: '/module/edit', data: params })

export const batchEditModule = (params: BatchEditModuleParam) =>
  defHttp.post<void>({ url: '/module/batch_edit', data: params })

export const deleteModule = (params: DeleteModuleParam) =>
  defHttp.post<void>({ url: '/module/delete', data: params })

export const getDependList = (params: GetDependListParam) =>
  defHttp.get<DependInfo[]>({ url: '/dependency/list', params })
